using UnityEngine;

public class CrashDetector : MonoBehaviour
{
	public GameUI GameUI;

	public RCCCarCamera camera;
	private float rotation;


	private void Update()
	{
		Vector3 eulerAngles = base.transform.eulerAngles;
		rotation = eulerAngles.z;
		if ((rotation > 240f && rotation < 300f) || (rotation > 70f && rotation < 180f))
		{
			GameUI.CrashDialogShow();
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		if (other.tag == "water" && !IgnoreWater.instance.ignore)
		{
			camera.playerCar = null;
			GameUI.CrashDialogShow();
		}
	}
}
